<?php


namespace TbfRuntime\Session;


class ArraySession implements SessionProvider{
    private $mockSessionData = array();
    /**
     * @param string $key
     * @return mixed
     */
    function get($key){
        if (!array_key_exists($key,$this->mockSessionData)){
            return '';
        }
        return $this->mockSessionData[$key];
    }

    /**
     * @param string $key
     * @param mixed $value
     * @return void
     */
    function set($key, $value)
    {
        $this->mockSessionData[$key] = $value;
    }

    /**
     * @return void
     */
    function regenerate()
    {
        $this->mockSessionData = array();
    }

    /**
     * @return void
     */
    function clear()
    {
        $this->mockSessionData = array();

    }

    /**
     * @return array map[string]interface{}
     */
    function getAll()
    {
        return $this->mockSessionData;

    }

    /**
     * @param array $array map[string]interface{}
     * @return void
     */
    function setAll($data)
    {
        $this->mockSessionData = $data;
    }
} 